
package jing.typedef.device.urn;

import jing.typedef.device.urn.schemas.Schemas;

public class DeviceType extends Urn {

    public DeviceType() {
    }

    public DeviceType(String subType, int version) {
        super.setType(Type.DEVICE);
        super.setDomain(Schemas.UPNP);
        super.setSubType(subType);
        super.setVersion(version);
    }

    public String getName() {
        return this.getSubType();
    }

    public static DeviceType create(String string) {
        DeviceType thiz = new DeviceType();
        if (!thiz.parse(string)) {
            thiz = null;
        }

        return thiz;
    }

    @Override
    public boolean parse(String string) {
        boolean ret;

        do {
            ret = super.parse(string);
            if (!ret) {
                break;
            }

            if (this.getType() != Type.DEVICE) {
                break;
            }

            ret = true;
        } while (false);

        return ret;
    }
}